
#ifndef __SDCP_DEF_H__
#define __SDCP_DEF_H__

// 协议内容相关的宏定义------------------------------------------------
/// @brief SDCP协议的消息类型定义
#define SDCP_MSG_TYPE_CONNECT 0x00
#define SDCP_MSG_TYPE_CONNACK 0x01
#define SDCP_MSG_TYPE_MSGPUSH 0x02
#define SDCP_MSG_TYPE_MSGACK 0x03
#define SDCP_MSG_TYPE_MSGREC 0x04
#define SDCP_MSG_TYPE_MSGREL 0x05
#define SDCP_MSG_TYPE_MSGCOMP 0x06
// ... [7,12] reserved 预留
#define SDCP_MSG_TYPE_PINGREQ 0x0d
#define SDCP_MSG_TYPE_PINGRESP 0x0e
#define SDCP_MSG_TYPE_DISCONNECT 0x0f

/// @brief QoS定义
#define SDCP_MSG_QOS0 0x00
#define SDCP_MSG_QOS1 0x01
#define SDCP_MSG_QOS2 0x02

/// @brief SDCP数据长度
#define SDCP_MSG_LEN_LEVEL0 0x00
#define SDCP_MSG_LEN_LEVEL1 0x01

/// @brief SDCP协议的扩展标记
#define SDCP_MSG_EXTEND_FLAG0 0x00
#define SDCP_MSG_EXTEND_FLAG1 0x01

// 在FIXED_HEADER中的值
// SDCP协议的消息类型定义
#define SDCP_MSG_TYPE_CONNECT_IN_FIXED_HEADER (SDCP_MSG_TYPE_CONNECT << 4)
#define SDCP_MSG_TYPE_CONNACK_IN_FIXED_HEADER (SDCP_MSG_TYPE_CONNACK << 4)
#define SDCP_MSG_TYPE_MSGPUSH_IN_FIXED_HEADER (SDCP_MSG_TYPE_MSGPUSH << 4)
#define SDCP_MSG_TYPE_MSGACK_IN_FIXED_HEADER (SDCP_MSG_TYPE_MSGACK << 4)
#define SDCP_MSG_TYPE_MSGREC_IN_FIXED_HEADER (SDCP_MSG_TYPE_MSGREC << 4)
#define SDCP_MSG_TYPE_MSGREL_IN_FIXED_HEADER (SDCP_MSG_TYPE_MSGREL << 4)
#define SDCP_MSG_TYPE_MSGCOMP_IN_FIXED_HEADER (SDCP_MSG_TYPE_MSGCOMP << 4)
// ... [7,12] reserved 预留
#define SDCP_MSG_TYPE_PINGREQ_IN_FIXED_HEADER (SDCP_MSG_TYPE_PINGREQ << 4)
#define SDCP_MSG_TYPE_PINGRESP_IN_FIXED_HEADER (SDCP_MSG_TYPE_PINGRESP << 4)
#define SDCP_MSG_TYPE_DISCONNECT_IN_FIXED_HEADER (SDCP_MSG_TYPE_DISCONNECT << 4)

// SDCP协议的消息质量
#define SDCP_MSG_QOS0_IN_FIXED_HEADER (SDCP_MSG_QOS0 << 2)
#define SDCP_MSG_QOS1_IN_FIXED_HEADER (SDCP_MSG_QOS1 << 2)
#define SDCP_MSG_QOS2_IN_FIXED_HEADER (SDCP_MSG_QOS2 << 2)

// SDCP数据长度
#define SDCP_MSG_LEN_LEVEL0_IN_FIXED_HEADER (SDCP_MSG_LEN_LEVEL0 < 1)
#define SDCP_MSG_LEN_LEVEL1_IN_FIXED_HEADER (SDCP_MSG_LEN_LEVEL1 < 1)

// SDCP协议扩展标志
#define SDCP_MSG_EXTEND_FLAG0_IN_FIXED_HEADER (SDCP_MSG_EXTEND_FLAG0)
#define SDCP_MSG_EXTEND_FLAG1_IN_FIXED_HEADER (SDCP_MSG_EXTEND_FLAG1)

// 初始化配置值
// 用户数据包长度，默认128字节
#define SDCP_MAX_PACKET_SIZE (128)
// 数据帧超时时间，默认2秒
#define SDCP_FRAME_TIMEOUT_TS_MS (1000 * 2)
// 数据帧错误时的重试次数，默认3次
#define SDCP_FRAME_RETRY_TIMES (3)

#endif // __SDCP_DEF_H__